<?php

namespace App\Http\Controllers\Web;

use App\Dao\Test;
use App\Http\Controllers\Controller;
use App\Http\Controllers\Web\BaseController;
use Illuminate\Support\Facades\Log;

class Test1Controller extends BaseController
{
    /**
     * 列表
     * @return bool|\Illuminate\Http\JsonResponse|mixed
     */
    public function index(){
        //没有任何逻辑的可以直接访问Dao层
        $list = Test::getList();
        return self::doResponseReturn('11111',$list->toArray());
    }


    public function show($id){
        $list = Test::getDetail($id);
        $list = $list ? $list->toArray() : [];
        return self::doResponseReturn('11111',$list);
    }

    public function store(){
        $result = Test::create();
        return self::doResponseReturn('11111',$result->toArray());
    }

    public function update($id){
        $result = Test::update($id);
        return self::doResponseReturn('11111',[]);
    }

    public function destroy($id){
        $result = Test::delete($id);
        return self::doResponseReturn('11111',[]);
    }
}
